home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6083 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: rz.uni-karlsruhe.de!ma2s2!haible
  2. From: haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible)
  3. Newsgroups: comp.lang.lisp,comp.lang.c++
  4. Subject: Re: Why garbage collection?
  5. Date: 11 Feb 1996 01:15:33 GMT
  6. Organization: University of Karlsruhe, Germany
  7. Message-ID: <4fjfvl$nps@nz12.rz.uni-karlsruhe.de>
  8. References: <hbaker-2201961503250001@10.0.2.15> <4eae5s$66p@nz12.rz.uni-karlsruhe.de> <822675271snz@wildcard.demon.co.uk> <DM09G0.MzG.0.macbeth@cogsci.ed.ac.uk>
  9. NNTP-Posting-Host: ma2s2.mathematik.uni-karlsruhe.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. Keywords: costs, low-level
  14. Originator: haible@ma2s2
  15.  
  16. Jeff Dalton <jeff@cogsci.ed.ac.uk> wrote:
  17.  
  18. >>> Just look at the technical strength of the argument that GC is not
  19. >>> "in the tradition of the C community"...
  20. >>
  21. >>Yeah, I love it. ;-)
  22. >
  23. > But it _is_ true that GC is not in the tradition of the C community.
  24. > The argument that it's a "hidden cost" is key here.  C programmers
  25. > feel that they know what everything will do in machine terms, and
  26. > to a fair extent they are right.  (That's so despite a number of
  27. > difficulties and exceptions.)
  28. >
  29. > So when a allocation might do lots of collecting as well (or
  30. > whatever), and you don't really know when, that seems to move
  31. > C into the higher-level / less-in-touch-with-the-machine camp.
  32.  
  33. But apparently more and more C programmers learn and use C++. This
  34. language also has hidden costs here and there:
  35.  
  36.   - An assignment may involve more than moving around memory words,
  37.  
  38.   - A method (a.k.a. "member function") call usually involves two
  39.     pointer accesses and two branches additionally to the C function
  40.     call,
  41.  
  42.   - Virtual inheritance introduces hidden pointers within the objects,
  43.  
  44.   - Exception handling adds tables whose size is comparable to the
  45.     size of the code,
  46.  
  47. and this is silently accepted by the C++ community. Exceptions
  48. haven't been in the C tradition either, yet they are very welcome
  49. in the C++ community. In fact, the C++ programmers are pushing the
  50. C++ compiler vendors to implement these things.
  51.  
  52. So: why had the GC to wait for the arrival of Java until it became
  53. widely accepted?
  54.  
  55.  
  56. Bruno Haible                                     email: <haible@ilog.fr>
  57. Software Engineer                                phone: +33-1-49083585
  58.  
  59.